<?php
class User_child extends MY_Controller
{	
	function __construct() {
        parent::__construct();
    }

    function get_study_report(){
        $data = $this->user_post_data;
        if(!empty($data)){
            $child_id = $data['child_id'];

            //孩子信息
            $this->load->model('User_child_model');
            $child_info = $this->User_child_model->get_info_by_id($child_id);
            $grade_array = array(
                '0'=>'学前班',
                '1'=>'一年级',
                '2'=>'二年级', 
                '3'=>'三年级', 
                '4'=>'四年级', 
                '5'=>'五年级', 
                '6'=>'六年级', 
                '7'=>'七年级', 
                '8'=>'八年级', 
                '9'=>'九年级', 
                '10'=>'高一', 
                '11'=>'高二', 
                '12'=>'高三', 
                '13'=>'其他', 
            );
            

            //返回数组
            $info = array(
                'child_id' => $data['child_id'], 
                'child_name' => $child_info['nick'],
                'child_img' => $child_info['head_img_url'],
                'gender' => $child_info['gender'],
                'grade' => $grade_array[$child_info['grade']],
                'zuoye_stars' => $child_info['zuoye_stars'],
                'zuoye_stars_a' => $child_info['zuoye_stars_a'],
                'zuoye_stars_b' => $child_info['zuoye_stars_b'],
                'zuoye_stars_c' => $child_info['zuoye_stars_c'],
            );

            echo json_encode(array("code" => 1, "data" => $info));
        }else{
            echo json_encode(array("code" => 404, "data" => 'not user'));
        }
        
    }

}